package com.studyroom.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.studyroom.dto.SearchDTO;
import com.studyroom.entity.Order;
import com.studyroom.entity.OrderItem;

import java.time.LocalDateTime;
import java.util.List;

public interface OrderService extends IService<Order> {
    
    /**
     * 搜索订单
     */
    IPage<Order> search(SearchDTO params);
    
    /**
     * 获取最新订单
     */
    List<Order> getLatestOrders(String username);
    
    /**
     * 获取订单详情
     */
    Order getOrderDetail(Long orderId);
    
    /**
     * 更新订单状态
     */
    boolean updateOrderStatus(Long orderId, Integer status);
    
    /**
     * 取消订单
     */
    void cancelOrder(String username, Long orderId);
    
    /**
     * 创建订单
     */
    void createOrder(String username, List<OrderItem> items, String deliveryLocation, LocalDateTime deliveryTime);
    
    /**
     * 获取我的订单
     */
    Page<Order> getMyOrders(String username, Integer status, Page<Order> page);
    
    /**
     * 检查是否是管理员
     */
    boolean isAdmin(String username);

    /**
     * 删除订单
     */
    boolean deleteOrder(Long id);
} 